#import "YLWebImageCompat.h"

#if YL_UIKIT

#import "YLWebImageManager.h"


@interface UIButton (WebCache)

#pragma mark - Image

- (nullable NSURL *)yl_currentImageURL;

- (nullable NSURL *)yl_imageURLForState:(UIControlState)state;

- (void)yl_setImageWithURL:(nullable NSURL *)url
                  forState:(UIControlState)state NS_REFINED_FOR_SWIFT;

- (void)yl_setImageWithURL:(nullable NSURL *)url
                  forState:(UIControlState)state
          placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;


- (void)yl_setImageWithURL:(nullable NSURL *)url
                  forState:(UIControlState)state
          placeholderImage:(nullable UIImage *)placeholder
                   options:(YLWebImageOptions)options NS_REFINED_FOR_SWIFT;

- (void)yl_setImageWithURL:(nullable NSURL *)url
                  forState:(UIControlState)state
                 completed:(nullable YLExternalCompletionBlock)completedBlock;

- (void)yl_setImageWithURL:(nullable NSURL *)url
                  forState:(UIControlState)state
          placeholderImage:(nullable UIImage *)placeholder
                 completed:(nullable YLExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;

- (void)yl_setImageWithURL:(nullable NSURL *)url
                  forState:(UIControlState)state
          placeholderImage:(nullable UIImage *)placeholder
                   options:(YLWebImageOptions)options
                 completed:(nullable YLExternalCompletionBlock)completedBlock;

#pragma mark - Background Image


- (nullable NSURL *)yl_currentBackgroundImageURL;

- (nullable NSURL *)yl_backgroundImageURLForState:(UIControlState)state;

- (void)yl_setBackgroundImageWithURL:(nullable NSURL *)url
                            forState:(UIControlState)state NS_REFINED_FOR_SWIFT;

- (void)yl_setBackgroundImageWithURL:(nullable NSURL *)url
                            forState:(UIControlState)state
                    placeholderImage:(nullable UIImage *)placeholder NS_REFINED_FOR_SWIFT;

- (void)yl_setBackgroundImageWithURL:(nullable NSURL *)url
                            forState:(UIControlState)state
                    placeholderImage:(nullable UIImage *)placeholder
                             options:(YLWebImageOptions)options NS_REFINED_FOR_SWIFT;

- (void)yl_setBackgroundImageWithURL:(nullable NSURL *)url
                            forState:(UIControlState)state
                           completed:(nullable YLExternalCompletionBlock)completedBlock;

- (void)yl_setBackgroundImageWithURL:(nullable NSURL *)url
                            forState:(UIControlState)state
                    placeholderImage:(nullable UIImage *)placeholder
                           completed:(nullable YLExternalCompletionBlock)completedBlock NS_REFINED_FOR_SWIFT;

- (void)yl_setBackgroundImageWithURL:(nullable NSURL *)url
                            forState:(UIControlState)state
                    placeholderImage:(nullable UIImage *)placeholder
                             options:(YLWebImageOptions)options
                           completed:(nullable YLExternalCompletionBlock)completedBlock;

#pragma mark - Cancel

- (void)yl_cancelImageLoadForState:(UIControlState)state;

- (void)yl_cancelBackgroundImageLoadForState:(UIControlState)state;

@end

#endif
